package cn.duyo.spring.beans.factory;

import cn.duyo.spring.beans.BeansException;

/**
 * bean工厂接口
 * @author du
 */
public interface BeanFactory {

    Object getBean(String name) throws BeansException;

    /**
     * 解决构造函数有形参的情况
     * @param name
     * @param args
     * @return
     * @throws BeansException
     */
    Object getBean(String name, Object ...args) throws BeansException;

    /**
     * 根据类型获取bean
     * @param name
     * @param requiredType
     * @param <T>
     * @return
     * @throws BeansException
     */
    <T> T getBean(String name, Class<T> requiredType) throws BeansException;

    <T> T getBean(Class<T> requiredType) throws BeansException;

    boolean containsBean(String name);
}
